package org.example.commons.service.impl;

import org.example.commons.entity.SysRole;
import org.example.commons.repository.SysRoleRepository;
import org.example.commons.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author 陈伯瑞
 * date 2020/6/16 0016 18:59
 * version 1.0
 **/
@Service
public class SysRoleServiceIml implements ISysRoleService {

    @Autowired
    SysRoleRepository sysRoleRepository;
    @Override
    public SysRole queryById(Long id) {
        return sysRoleRepository.getOne(id);
    }

    @Override
    public Page<SysRole> queryAllPage(Pageable pageable) {
        return sysRoleRepository.findAll(pageable);
    }

    @Override
    public List<SysRole> queryAll() {
        return  sysRoleRepository.findAll();
    }

    @Override
    public SysRole insert(SysRole entity) {
        return sysRoleRepository.save(entity);
    }

    @Override
    public SysRole update(SysRole entity) {
        return sysRoleRepository.save(entity);
    }

    @Override
    public void deleteById(Long id) {
           sysRoleRepository.deleteById(id);
    }
    /**
     *
     */
}
